【buu】[Zer0pts2020]easy_strcmp
elf文件拖入ida中查看main没啥大用,根据题目跟进strcmp也还是原来的正常的strcmp
动调看一下发现strcmp的函数变了,
a1是我们要输入的flag,a2是这个要比对的字符串
第一条语句是要计算a1的长度,抽象吧
v4是更为抽象的,哪个位运算实际上应当是i/8,把a1的字符串8个分为一组
结合下面的循环会发现 i=24因为qword_5C2570201060有3组 有用的8位数据
qword_5C2570201060[0]是0不用管
从qword_5C2570201060[1]开始思考
每次输入的字符串都要和qword_5C2570201060[1]进行相减
最后的qword_5C2570201090(a1, a2)疑似变成了strcmp
所以脚本应为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| import binascii
enc = "********CENSORED********" key = [0x410A4335494A0942, 0x0B0EF2F50BE619F0, 0x4F0A3A064A35282B]
flag = b''
for i in range(3): p = enc[8*i:(i+1)*8] a = binascii.b2a_hex(p.encode('ascii')[::-1]) b = binascii.a2b_hex(hex(int(a,16)+key[i])[2:])[::-1] flag += b
print(flag)
|
还有个比较容易理解的脚本
【点击这里】https://blog.csdn.net/qq_64558075/article/details/121926861?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522172135997916800211590777%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=172135997916800211590777&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-18-121926861-null-null.142